set(LOCAL_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(DVPP_CMDLIST_PATH  ${TOP_DIR}/ace/dvpp/dvpp/dvpp_cmdlist)

add_library(dvpp_cmdlist SHARED
    ${LOCAL_PATH}/vpc/xauxx/format/vpc_pipe_format.c
    ${LOCAL_PATH}/vpc/xauxx/format/field/gray_field.c
    ${LOCAL_PATH}/vpc/xauxx/format/field/rgb_field.c
    ${LOCAL_PATH}/vpc/xauxx/format/field/yuv_field.c
    ${LOCAL_PATH}/vpc/xauxx/resize/vpc_pipe_resize.c
    ${LOCAL_PATH}/vpc/xauxx/yuvscaler/vpc_pipe_yuvscaler.c
    ${LOCAL_PATH}/vpc/xauxx/yuvscaler/coeff/yuv_scaler_para_set.c
    ${LOCAL_PATH}/vpc/xauxx/csc/vpc_pipe_csc.c
    ${LOCAL_PATH}/vpc/src/vpc_pipe_proc.c
    ${LOCAL_PATH}/vpc/src/vpc_pipe_channel.c
    ${LOCAL_PATH}/vpc/src/vpc_pipe_kernel.c
    ${LOCAL_PATH}/vpc/src/mlv1r1/vpc_pipe_mlv1r1.c
    ${LOCAL_PATH}/vpc/src/mlv1r3/vpc_pipe_mlv1r3.c
    ${LOCAL_PATH}/vpc/ext/dvpp_vpc_pipe.c
    ${DVPP_CMDLIST_PATH}/cmdlist/vpc/pipeline/pipeline_top.c
    ${DVPP_CMDLIST_PATH}/cmdlist/vpc/pipeline/pipeline_module.c
)

target_include_directories(dvpp_cmdlist PRIVATE
    ${LOCAL_PATH}/vpc/xauxx/format
    ${LOCAL_PATH}/vpc/xauxx/format/field
    ${LOCAL_PATH}/vpc/xauxx/csc
    ${LOCAL_PATH}/vpc/xauxx/yuvscaler
    ${LOCAL_PATH}/vpc/xauxx/yuvscaler/coeff
    ${LOCAL_PATH}/vpc/xauxx/resize
    ${LOCAL_PATH}/vpc/inc
    ${LOCAL_PATH}/vpc/src
    ${LOCAL_PATH}/vpc/ext
    ${DVPP_CMDLIST_PATH}/base
    ${TOP_DIR}/ace/dvpp/inc/dvpp/vpc_pipeline
    ${TOP_DIR}/ace/dvpp/inc/dvpp
    ${TOP_DIR}/ace/dvpp/inc/external/dvpp


    ${TOP_DIR}/ace/media/mediabase/inc/external/mediabase
    ${TOP_DIR}/ace/media/mediabase/inc/mediabase/include
    ${TOP_DIR}/ace/media/mediabase/inc/mediabase/include/adapt
    ${TOP_DIR}/ace/media/mediabase/src/base/arch/hidvpp/include

    ${TOP_DIR}/abl/libc_sec/include
)

target_compile_options(dvpp_cmdlist PRIVATE
    -g
    -pthread
    -O2
    -fpie
    -fstack-protector-all
    -fpic
    -fno-common
    -Wformat=2
    -Wfloat-equal
    -Wshadow
    -Wdate-time
    -Wstrict-prototypes # C only
)

target_compile_definitions(dvpp_cmdlist PRIVATE
)

target_link_options(dvpp_cmdlist PRIVATE
    -Wl,-z,relro
    -Wl,-z,now
    -Wl,-z,noexecstack
    -fvisibility=hidden
)

target_link_libraries(dvpp_cmdlist PRIVATE
    slog
    $<BUILD_INTERFACE:intf_pub>
    $<BUILD_INTERFACE:slog_headers>
    $<BUILD_INTERFACE:dvpp_headers>
)

install_package(
    PACKAGE acldvpp
    TARGETS dvpp_cmdlist
    DESTINATION ${INSTALL_INCLUDE_DIR}/acldvpp/external/dvpp
)